package com.tma.timesheettracker.adapter;

import java.util.List;
import com.tma.timesheettracker.R;
import com.tma.timesheettracker.contentprovider.TimeTrackerContentProvider;
import com.tma.timesheettracker.model.Task;
import android.content.Context;
import android.widget.ArrayAdapter;

public class AutoCompleteAdapter {

	private String[] autolstTask;
	private ArrayAdapter<String> adapter;

	public AutoCompleteAdapter(Context context, List<Task> lstTask) {
		lstTask = TimeTrackerContentProvider.TaskTable.getTasks(context.getContentResolver());
		if (lstTask != null) {
			autolstTask = new String[lstTask.size()];
			for (int i = 0; i < lstTask.size(); i++) {
				autolstTask[i] = lstTask.get(i).getName();
			}
			setAdapter(new ArrayAdapter<String>(context, R.layout.record_work_auto_item, autolstTask));
		}
	}

	public ArrayAdapter<String> getAdapter() {
		return adapter;
	}

	public void setAdapter(ArrayAdapter<String> adapter) {
		this.adapter = adapter;
	}

}
